package com.jeeplus.modules.sys.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.adjunctFile.mapper.AdjunctFileMapper;
import com.jeeplus.modules.sys.entity.*;
import com.jeeplus.modules.sys.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author xujin
 * @title: DictValueService
 * @projectName EAS
 * @description: TODO
 * @date 2019-10-0911:15
 */
@Service
@Transactional(readOnly = true)
public class DictValueService extends CrudService<DictValueMapper, DictValue> {

    @Autowired
    ArchCostItemMapper archCostItemMapper;

    @Autowired
    private LateFeePlanMapper lateFeePlanMapper;

    @Autowired
    ObjectCostItemMapper objectCostItemMapper;

    @Autowired
    AdjunctClassMapper adjunctClassMapper;

    @Autowired
    DictValueMapper dictValueMapper;

    @Autowired
    StockRuleMapper stockRuleMapper;


    /*档案款项设置*/
    public Page<DictValue> findPage(Page<DictValue> page, DictValue dictValue) {
        DictType dictType = new DictType();
        dictType.setId("cc5c8ebeada1477da8913a19bf7619e5");
        dictValue.setDictType(dictType);
        return super.findPage(page, dictValue);
    }

    public Page<DictValue> findCostPage(Page<DictValue> page, DictValue dictValue) {
        DictType dictType = new DictType();
        dictType.setId("d82903f750e840fca09e7f54fadada47");
        dictValue.setDictType(dictType);
        return super.findPage(page, dictValue);
    }

    public ArchCostItem getArchCostItem(String id) {
        return archCostItemMapper.get(id);
    }



    /*单据款项设置*/
    public Page<DictValue> findPage1(Page<DictValue> page, DictValue dictValue) {
        DictType dictType = new DictType();
        dictType.setId("dd92c44bd2ab49459e048b88324b047e");
        dictValue.setDictType(dictType);
        return super.findPage(page, dictValue);
    }

    /*附件分类设置*/
    public Page<DictValue> findPage2(Page<DictValue> page, DictValue dictValue) {
        dictValue.setDictType(new DictType());
        dataRuleFilter(dictValue);
        dictValue.setPage(page);
        return page.setList(dictValueMapper.findList2(dictValue));
    }

    public ObjectCostItem getObjectCostItem(String id) {
        return objectCostItemMapper.get(id);
    }

    /*违约金方案*/
    public Page<DictValue> findPage3(Page<DictValue> page, DictValue dictValue) {
        DictType dictType = new DictType();
        dictType.setId("cc5c8ebeada1477da8913a19bf7619e5");
        dictValue.setDictType(dictType);
        return super.findPage(page, dictValue);
    }

    public LateFeePlan getLateFeePlan(String id) {
        return lateFeePlanMapper.get(id);
    }

    public AdjunctClass getAdjunctClass(String id) {
        return adjunctClassMapper.get(id);
    }


    /*附件分类设置*/
    public Page<DictValue> findPage4(Page<DictValue> page, DictValue dictValue) {
        dictValue.setDictType(new DictType());
        dataRuleFilter(dictValue);
        dictValue.setPage(page);
        return page.setList(dictValueMapper.findList4(dictValue));
    }

    public StockRule getStockRule(String id) {
        return stockRuleMapper.get(id);
    }

}
